<% avatar_can_be_edited_by_current_user = mine?(@avatar_owner_instance) || @avatar_owner_instance.can_be_edited_by?(current_user) -%>

<ul class="sectionIcons">
	<li><%= icon(@avatar_owner_instance.class.name.downcase, url_for(@avatar_owner_instance), nil, nil, 'Return to Profile')%></li>
  <% if avatar_can_be_edited_by_current_user -%>
    <li><%= icon('avatar', new_avatar_link(@avatar_owner_instance), nil, nil, 'Upload New Picture')%></li>
  <% end %>
</ul>


<h1><%= @avatar_for -%> Pictures: <%= link_to @avatar_owner_instance.name, url_for(@avatar_owner_instance) -%></h1>

<% unless @avatars.empty? %>

<br/>
<table class="alt_table">
  
<% odd_row = false -%>
<% for avatar in @avatars -%>
  <tr class="<%= (odd_row = !odd_row) ? "odd_row" : "even_row" -%>">
    <td width="150" style="padding-top: 3em;">
      <% if avatar.selected? -%> 
				<%= icon "tick", nil, nil, nil, "" -%><br/>
        Current
      <% end -%>
    </td>
    <td>
      <%= image_tag avatar_url(@avatar_owner_instance, avatar.id, 100), :alt => @avatar_owner_instance.name, :class => 'framed' -%>
    </td>
    <td class="actions">
			<% if avatar_can_be_edited_by_current_user -%>
				<% avatar_link = avatar_url(@avatar_owner_instance, avatar.id) -%>
				<% unless avatar.selected? -%>
					<%= icon "avatar", avatar_link + "/select", nil, { :method => :post }, "Set as Main Picture" -%>
				<% end -%>
			<% end -%>
			<%# "enlarge" option is shown to everyone -%>
			<%#= icon "show", avatar_url(@avatar_owner_instance, avatar.id, "large"), nil, nil, "Enlarge" -%>
			<% if avatar_can_be_edited_by_current_user -%>
				<%= icon "destroy", avatar_link, nil, { :confirm => 'Are you sure?', :method => :delete }, "Delete" -%>
			<% end -%>
    </td>
  </tr>
<% end -%>
</table>

<% else -%>

<div class="show_basic">
  <p class="none_text" style="text-align: center; font-size: 123.1%;">
  	No avatars yet!
	</p>
</div>

<% end -%>

<br />